
# ifndef __DFX_RENDER_DATA_OGL_H__
# define __DFX_RENDER_DATA_OGL_H__

# include <GL/glew.h>
# include <GL/GL.h>

# include "dfxRenderData.h"

namespace DFX
{
    class RenderData_OGL : public RenderData
    {
    private:

        GLuint  mVAOHandle;
        GLuint  mVBHandle;
        GLuint  mIBHandle;
        GLuint  mIndexType;

    public:

        RenderData_OGL(GraphicsDevice *gd, const String &name);
        ~RenderData_OGL();        

        GLuint GetVAOHandle() const
        {
            return mVAOHandle;
        }

        GLuint GetVBHandle() const
        {
            return mVBHandle;
        }

        GLuint GetIBHandle() const
        {
            return mIBHandle;
        }

        DFXRESULT CreateVertexBuffer(BUFFER_USAGE vbUsage, VertexFormat *format, UInt32 numVertices, void *initialData);
        DFXRESULT CreateIndexBuffer(BUFFER_USAGE ibUsage, UInt32 indexSize, UInt32 numIndices, void *initialData);

        bool HasIndices();

        DFXRESULT MapVertexBuffer(void **buffer, UInt32 mapFlags);
        DFXRESULT UnmapVertexBuffer();

        DFXRESULT MapIndexBuffer(void **buffer, UInt32 mapFlags);
        DFXRESULT UnmapIndexBuffer();

        void Activate();

        void Draw(PRIMITIVE_TYPE type);
        void Draw(PRIMITIVE_TYPE type, UInt32 start, UInt32 end, UInt32 count);

        void Destroy();
    };
}

# endif